#
# clear the logs and config files
#
rm -f /etc/kservers ; rm -f /etc/kusers ; rm -f /etc/kconf.conf 

#
# kill python processes if any
#
killall -9 python

#
# server details:
#
# kerberos server IP: 164.99.136.13
# service server IP: 164.99.136.175
# client IP: 164.99.136.13
# username of client: test
# password of client: test
# username of admin of service server: root
# password of admin of service server: admin
#

#
# start the main kerberos server on 164.99.136.13 (kerberos server IP)
#
python kserv.py &
#
# create the application server key in kerberos server
# this command will be executed on the local machine where the kerberos
# @server exists (164.99.136.13), and the resultant key will be stored 
# @in kerberos server and should also be transported securely 
# @to the service server
#
echo "creating application server key in kerberos server"
python kmanage-local.py -o crtserver -a root -s /root/.serverKey

#
# securely copy the service server key to service server
#
scp /root/.serverKey root@164.99.136.175:/root/

#
# The following command will be executed on 164.99.136.175 (service server IP)
#
# python ksvc.py &
#
# create the user hash hashed with the application server hash in the kerberos server
# the key transferred securely from kerberos server will come to use here
# the key can be stored in a secure file in the home directory (hidden file preferred)
# @called .serverKey
#
# echo "creating user hash in kerberos server"
# python kmanage.py -o crtuser -u test -s 164.99.136.13 -k /root/.serverKey -t /root/.userKeys

#
# authenticate with user hash
# This command will be executed on 164.99.136.13 (client IP)
#
# echo "authenticating user"
# python kinit.py -u test -s 164.99.136.13 -a 164.99.136.175


